package com.lhf.springcloud.DAO;

import com.lhf.springcloud.Entity.StudentBasicData;
import com.lhf.springcloud.Entity.StudentBasicInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface StudentEssentialInformationDao {
    @Insert("insert into student_data (id,studentName,idCard,studentXJ,entrance,studentStatus,political,familyPhotoNumber,studentAddress,photoNumber,studentImgUrl,infoJudge) values((select uuid()),#{studentName},#{idCard},#{studentXJ},#{entrance},#{studentStatus},#{political},#{familyPhotoNumber},#{studentAddress},#{photoNumber},#{studentImgUrl},#{infoJudge})")
    void addCourse(StudentBasicData course);
    @Select("select id,studentName,idCard,studentXJ,entrance,studentStatus,political,familyPhotoNumber,studentAddress,photoNumber,studentImgUrl,infoJudge from student_data")
    List<StudentBasicData> findAllStudentEssentialInformation();
    @Select("select idCard from student_basic_info where idCard=#{idCard}")
    String findStudentBasicDataByIdCard(String idCard);
    @Update("UPDATE student_data SET ${dataName} = #{dataValue} WHERE id = #{id} ")
    void updateData(String dataValue, String id, String dataName);
    @Select("select * from student_data where idCard=#{idCard}")
    List<StudentBasicData> findByIdCard(String idCard);
    @Select("select * from student_data where id=#{id}")
    StudentBasicData findByStudentId(String id);
    @Update("UPDATE student_data SET  infoJudge= #{falses} WHERE id = #{id}")
    void updateStudentStatus(String falses,String id);
}
